<div id="content-box">
<div class="content_top"><div class="settings"><h1><?php echo $model->name; ?></h1></div></div>
<div class="pagecnt">
<?php //echo CHtml::link('Delete', '#', array('submit'=>array('delete','id'=>$model->id),'class'=>'save', 'confirm'=>'Are you sure you want to delete this item?')); ?>

<div class="form">

    <?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'content-edit-form',
    'enableAjaxValidation'=>false,
)); ?>


    <p class="note">Fields with <span class="required">*</span> are required.</p>
     <dd>
	   <div class="dd_left"><?php echo $form->labelEx($model,'application_id'); ?></div>
	   <div class="dd_right"> <?php echo $form->dropDownList($model,'application_id',$applications); ?></div>
       <div class="errorbox"><?php echo $form->error($model,'parent_id'); ?></div>
	</dd>
     <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'parent_id'); ?></div>
	   <div class="dd_right">  <?php echo $form->dropDownList($model,'parent_id',$parentList);?></div>
       <div class="errorbox"> <?php echo $form->error($model,'parent_id'); ?></div>
	</dd>
    <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'content_type_id'); ?></div>
	   <div class="dd_right">  <?php echo $form->dropDownList($model,'content_type_id',$contentTypes);?></div>
       <div class="errorbox"> <?php echo $form->error($model,'content_type_id'); ?></div>
	</dd>
    <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'name'); ?></div>
	   <div class="dd_right">  <?php echo $form->textField($model,'name');?></div>
       <div class="errorbox"> <?php echo $form->error($model,'name'); ?></div>
	</dd>
    <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'icon_file_name'); ?></div>
	   <div class="dd_right">  <?php echo $form->textField($model,'icon_file_name');?></div>
       <div class="errorbox"> <?php echo $form->error($model,'icon_file_name'); ?></div>
	</dd>
   <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'text'); ?></div>
	   <div class="dd_right">  <?php $this->widget('application.extensions.cleditor.ECLEditor', array(
        'model'=>$model,
        'attribute'=>'text', //Model attribute name. Nome do atributo do modelo.
        'options'=>array(
            'width'=>'375',
            'height'=>'250',
            'useCSS'=>true,
        ),
        'value'=>$model->text, //
    ));
    ?></div>
       <div class="errorbox"> <?php echo $form->error($model,'text'); ?></div>
	</dd>
    <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'active_start_date'); ?></div>
	   <div class="dd_right"> <?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
    $this->widget('CJuiDateTimePicker',array(
        'model'=>$model, //Model object
        'attribute'=>'active_start_date', //attribute name
                'mode'=>'datetime', //use "time","date" or "datetime" (default)
        'options'=>array('dateFormat'=>'yy-mm-dd','timeFormat'=>'hh:mm:ss'), // jquery plugin options
         'language' => '',
    ));
?></div>
       <div class="errorbox"> <?php echo $form->error($model,'active_start_date'); ?></div>
	</dd>
    <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'active_end_date'); ?></div>
	   <div class="dd_right"> <?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
    $this->widget('CJuiDateTimePicker',array(
        'model'=>$model, //Model object
        'attribute'=>'active_end_date', //attribute name
                'mode'=>'datetime', //use "time","date" or "datetime" (default)
        'options'=>array('dateFormat'=>'yy-mm-dd','timeFormat'=>'hh:mm:ss'), // jquery plugin options
         'language' => '',
    ));
?></div>
       <div class="errorbox"> <?php echo $form->error($model,'active_end_date'); ?></div>
	</dd>
    <dd>
	   <div class="dd_left"> <?php echo $form->labelEx($model,'content_status_id'); ?></div>
	   <div class="dd_right"><?php echo $form->dropDownList($model,'content_status_id',$contentStatuses);?></div>
       <div class="errorbox"> <?php echo $form->error($model,'content_status_id'); ?></div>
	</dd>
   
    <?php 
		if(!empty($model->contentType))
		{
			$contentModel = $model->contentType->name;	

			if(!empty($model->$contentModel))		
			{
				echo '<div class="button_section"></div>';
				echo '<dd style="padding-top:15px;padding-bottom:15px;"><div class="left"><h2>Extra Content Fields</h2></div></dd>';
				foreach ($model->$contentModel->attributeNames() as $field) 
				{
				     echo "<dd>";
					if(in_array($field, Content::$hiddenFields))
					{
						 echo $form->hiddenField($model->$contentModel, $field);					
					}else{
						echo "<div class='dd_left'> ".$form->labelEx($model->$contentModel,$field)."</div>"; 
			        	echo "<div class='dd_right'> ".$form->textField($model->$contentModel,$field)."</div>"; 
			        	echo "<div class='errorbox'> ".$form->error($model->$contentModel,$field)."</div>"; 	
					}			
	                echo "</dd>";	
				}
			}
		}
		else
		{
			echo '<h2>Save Content Item to add Extra attributes..</h2>';
		}
	?>
    
   <div class="button_section"></div>
        <?php echo CHtml::submitButton('Submit',array('class'=>'save')); ?>
   

    <?php $this->endWidget(); ?>

</div><!-- form -->
</div>
</div>